package com.yang.springcloud.service;

import com.yang.springcloud.pojo.Dept;
import com.yang.springcloud.service.impl.DeptClientServiceFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;

import java.util.List;

/**
 * @author shiwen
 * @date 2021/2/6
 */
@Component
@FeignClient(value = "SPRINGCLOUD-PROVIDER-DEPT-APPLICATION-NAME", fallbackFactory = DeptClientServiceFallbackFactory.class)  // 失败时回调
public interface DeptClientServer {

    @GetMapping("/dept/get/{id}")
    Dept queryById(@PathVariable("id") Long id);

    @GetMapping("/dept/list")
    List<Dept> queryAll();

    @PostMapping("/dept/add")
    boolean addDepe(Dept dept);

}